package com.bml.architect.proivder.service;

import com.bml.architect.DemoService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

@Service(version = "timeout",timeout = 5000,retries = 1)
public class TimeoutDemoServiceImpl implements DemoService {


    @Override
    public String sayHello(String name) {
        try {
            System.out.println("开始调用..");
            Thread.sleep(6000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        URL url = RpcContext.getContext().getUrl();
        System.out.println("调用完成");
        return String.format("%s:%s,hello,%s",url.getProtocol(),url.getPort(),name);
    }
}
